import {createRouter,createWebHistory} from 'vue-router'

import LoginVue from '@/views/Login.vue'
import LayoutVue from '@/views/Layout.vue'
import UserInfoVUe from '@/views/user/UserInfo.vue'
import UserAvatarVue from '@/views/user/UserAvatar.vue'
import UserResetPassword from '@/views/user/UserResetPassword.vue'
import ArticleCategoryVue from '@/views/article/ArticleCategory.vue'
import ArticleManage from '@/views/article/ArticleManage.vue'
//定义路由关系
const routes = [
    {
        path: '/',
        name: 'layout',
        component: LayoutVue,
        redirect:"/article/manage",
        children: [
            {path: '/user/userinfo', name: 'userinfo', component: UserInfoVUe},
            {path: '/user/useravatar', name: 'useravatar', component: UserAvatarVue},
            {path: '/user/resetpassword', name: 'resetpassword', component: UserResetPassword},
            {path: '/article/category', name: 'category', component: ArticleCategoryVue},
            {path: '/article/manage', name: 'manage', component: ArticleManage},
        ]
    },
    {
        path: '/login',
        name: 'login',
        component: LoginVue,
    }
]

//创建路由对象
const router = createRouter({
    history: createWebHistory(),
    routes
})

//导出路由
export default router